home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
001-025
/
scopedisk4
/
update
/
cpdoc
next >
Wrap
Text File
|
1995-03-18
|
6KB
|
116 lines
UpDate - a replacement for AmigaDos Copy that retains the date.
I recently downloaded from People Link an ARC file containing
two different "copy" replacements. One would copy only if the
destination did not exist, or was older. It copied full directories
if the destination existed, but would not create any.
The other used pattern matching and would accept the "all" switch,
but copied over files without regard to date.
Both revised the date of the copy to match the orriginal.
I decided to combine the best traits of both. Since "Disk.info"
and ".info" (that's plain ".info" as found in any drawer whos
window has been opened from Workbench) are usually "eccess
baggage" when updating a directory, (who needs to update
"Disk.info" and DOS updates ".info" every time you write to
or delete from a directory) they waste time if copied. Hence
"UpDate" won't copy them. So if you need to copy "Disk.info",
use "good ole copy"! (Somebody please tell me why DOS doesn't
copy the filedate? Who cares WHEN it was COPIED? We do, often,
care when it was CREATED or REVISED!)
As an added bonus, UpDate copies the comment, if any, attached
to the file. (Something ELSE AmigaDOS SHOULD do!)
UpDate is a child of "Cp"
by Jeff Lydiatt
Vancouver, Canada
Release 1.0, May 17, 1987
whos c source was the basis for most of it.
Cp was cleaned up to remove some potential leftover
file locks (in event of error).
UpDate modifies Cp to NOT copy if destination file same date,
or newer than source, to copy comments, to ignor ".info" and.
"Disk.info", and to create destination directories in more
casses. For example, orriginally given "Cp DF1:#?.c RAM:Work",
Cp would dutifully copy each file on DF1: whose name endded in
".c" to a FILE named "RAM:Work" if the directory named "RAM:Work"
did not exist! UpDate would, in the same instance, first create
"RAM:Work", and then copy the files into it.
The orriginal code was also made shorter so that the net increase
WITH the added features increased code size from 7576 for Cp
to 7964 for UpDate. (Compared to AmigaDOS "copy" at 8128!).
Many thanks to Jeff for his C code. I will happily provide
the modified code, should someone want it.
Enjoy!
John Scheib (PLink "JSCHEIB")
UpDate has most of the features of the AmigaDos copy command:
--------------------------------------------------------
o UpDate supports AmigaDos style pattern matching in the "from" name.
o UpDate supports the All option.
o UpDate supports optional "from" and "to" qualifiers for file names.
o UpDate will copy directories
UpDate has a number of features not found in AmigaDos copy:
-------------------------------------------------------
o UpDate will retain the date of the copied file.
o UpDate uses a 32000 byte buffer, which speeds copies when the from and
to file is on the same disk.
o UpDate WILL NOT copy "Disk.info" or ".info" (will copy
"FileName.info").
o UpDate will creat destination directories. (See Examples)
o UpDate will copy file comments.
o You may specify the current directory by a "to" name of ".". For
example if your current directory is "Df0:",
"cp ram:x ."
will copy the file called x in your ram: disk to "df0:x".
o UpDate will also create the "to" file for you if you use the "All"
option. For example if "x" is a directory,
"cp from x to y"
will create a directory called "y", and will copy all the files in
x to the newly created "y" directory.
About the AmigaDos-style pattern matching.
-----------------------------------------
UpDate uses a compact function for regular expression pattern matching.
The algorithm was taken from a paper by Martin Richards, that was
published in the September 1979 issue of "Software, Practice and
Experience". Professor Richards published his example in BCPL, and
Mr. Lydiatt has (sucessfully I think) translated it to C. It's interesting to
note that he translated it verbatim, with no special modifications to
adapt it to AmigaDos conventions.
UpDate recognises a number of special characters with special meanings,
which can be used to recognise any other charcaters that match them.
? Matches any single character.
% Matches the null character.
#<p> Matches zero or more occurrences of the pattern <p>
<p1>|<p2> Matches either pattern <p1> or <p2>.
() Can be used to group expressions together.
'# Can be used to turn off the special meaning of the special
characters #, ?, %, |, (, ), or '.
Some examples will help to make this clearer.
UpDate a|b . copies a or b to the current directory.
UpDate a#bc . copies ac abc abbc.
UpDate a#(b|c)d . copies ad abd abcd.
UpDate a?b . copies axb ayb aab.
UpDate a#?b copies ab axxb ax.ab.
UpDate '?#?'# . copies ?# ?ab# ??##.
UpDate a(b|%)#c . copies a abc accc.
UpDate FileName1 To FileName2 copies FileName1 to FileName2 (except as noted)
UpDate DirectoryName PotenTialDirectoryName creats the destination if
it doesn't exist. For Example:
"UpDate DF1: RAM:Work" will create RAM:Work if it does not exist.
and will the update it to match files on DF1:.
"UpDate DF1:#?whatever RAM:Work" would do the same with pattern matching.